package com.vibration.matlab;

import com.mathworks.toolbox.javabuilder.MWClassID;
import com.mathworks.toolbox.javabuilder.MWException;
import com.mathworks.toolbox.javabuilder.MWNumericArray;
import com.mathworks.toolbox.javabuilder.MWStructArray;
import getFirstData.GetFirstData;

import java.beans.IntrospectionException;

/**
 * 计算数据给迭代用
 *
 */
public class GetData {

    /**
     * 得到输出
     * function[aopt,aini,L2i1,L2opt,L2optimo,DCopt,HVopt,NN1,NN2]
     *
     * @return
     */
    public static Object[] getData(A a, double[][] DCT, double[][]HVT, double[][] L2i, double[][][] mod) throws MWException, IntrospectionException {
        GetFirstData getFirstData=new GetFirstData();
        //转化结构体
        MWStructArray  matA = MWStructArray.fromBean(a);
        //转换矩阵
        MWNumericArray matDCT = new MWNumericArray(DCT, MWClassID.DOUBLE);
        MWNumericArray matHVT = new MWNumericArray(HVT, MWClassID.DOUBLE);
        MWNumericArray matL2i = new MWNumericArray(L2i, MWClassID.DOUBLE);
        MWNumericArray matMod = new MWNumericArray(mod, MWClassID.DOUBLE);
        Object[] res=getFirstData.getFirstData(9,matA,matDCT,matHVT,matL2i,matMod);
        return res;
    }

}
